﻿using System;
using fastCSharp;

namespace diantou.web.ajax.admin
{
    /// <summary>
    /// 测试调用
    /// </summary>
    [fastCSharp.code.cSharp.ajax(IsPool = true)]
    class judge : permissionHandle<judge>
    {
        /// <summary>
        /// 
        /// </summary>
        /// <param name="startId"></param>
        /// <param name="endId"></param>
        /// <param name="onReturn"></param>
        /// <returns></returns>
        public void ReJudge(int startId, int endId, Action<fastCSharp.net.returnValue<int>> onReturn)
        {
            if (currentUser.Permission == dataModel.user.permission.Admin) diantou.dataAccess.tcpCall.judge.reJudge(startId, endId, onReturn);
            else onReturn(0);
        }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="ids"></param>
        /// <param name="onReturn"></param>
        /// <returns></returns>
        public void ReJudges(int[] ids, Action<fastCSharp.net.returnValue<int>> onReturn)
        {
            if (currentUser.Permission == dataModel.user.permission.Admin) diantou.dataAccess.tcpCall.judge.reJudge(ids, onReturn);
            else onReturn(0);
        }
        /// <summary>
        /// 检测测试提交集合状态
        /// </summary>
        /// <param name="ids"></param>
        /// <returns></returns>
        public diantou.dataModel.judgeState[] CheckJudges(int[] ids)
        {
            return diantou.dataAccess.tcpCall.judge.checkJudges(ids);
        }
        /// <summary>
        /// 特判程序
        /// </summary>
        /// <param name="value"></param>
        /// <param name="isProgram"></param>
        /// <param name="onReturn"></param>
        public void SpecialProgram(diantou.dataAccess.judge value, bool isProgram, Action<fastCSharp.net.returnValue<diantou.dataAccess.judgeClient.testJudge>> onReturn)
        {
            value.UserId = currentUser.Id;
            diantou.dataAccess.tcpCall.judge.SpecialProgram(value, isProgram, onReturn);
        }
        
    }
}